import store from '../store'
import request from '@/utils/request'
// const TokenKey = 'Authorization'

let authLock = true
/**
 * 获取token
 */
export function getToken () {
  return store.getters.token
}

export function auth () {
  return request({
    method: 'post',
    url: '/common/auth',
    params: {
      'refreshToken': store.getters.refreshToken
    }
  })
}

export function lock () {
  if (authLock) {
    authLock = false
    return true
  }
  return false
}

export function unLock () {
  authLock = true
}
